﻿DECLARE @sql NVARCHAR(MAX) = N'';

SELECT @sql += N'ALTER TABLE ' + QUOTENAME(TABLE_SCHEMA) + N'.' + QUOTENAME(TABLE_NAME) + N' ALTER COLUMN '
               + QUOTENAME(COLUMN_NAME) + N' DATETIME2;' + CHAR(13)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE DATA_TYPE = 'DATETIME';

EXEC sp_executesql @sql;